#!/bin/sh

screenshot_notification(){
	convert "$1" png:"$HOME/.cache/temp_screen.png"
	dunstify -h string:x-dunst-stack-tag:screenshot -A "open,open" "Qtile" "Screenshot Taken" -I "$HOME/.cache/temp_screen.png"
	rm ~/.cache/temp_screen.png
}

if [ "$2" = "True" ]; then
	scrot -F "$1"
elif [ "$3" = "True" ]; then
	scrot -s "$1"
else
	scrot --focused "$1"
fi
action=$(screenshot_notification "$1") 
if [ "$4" = "True" ]; then
	bzip2 "$1"
	name="$1.bz2"
else
	name="$1"
fi
if [ "$action" = "open" ]; then
	nsxiv "$name"
fi
